package com.finger.hospservice.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.finger.hospservice.mapper.DictMapper;
import com.finger.modelservice.model.cmn.Dict;
import com.finger.modelservice.vo.cmn.DictEeVo;
import org.springframework.beans.BeanUtils;

public class ExcelDictListener extends AnalysisEventListener<DictEeVo> {

    private DictMapper dictMapper;

    public ExcelDictListener(){

    }
    public ExcelDictListener(DictMapper dictMapper){
        this.dictMapper = dictMapper;
    }


    @Override
    public void invoke(DictEeVo dictEeVo, AnalysisContext analysisContext) {

        Dict dict = new Dict();

        BeanUtils.copyProperties(dictEeVo,dict);

        dictMapper.insert(dict);

    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
